//
//  UIColor+JFStockCustom.m
//  JFStock
//
//  Created by Jianbo Cai on 2019/6/12.
//  Copyright © 2019年 Alan Wang. All rights reserved.
//

#import "UIColor+JFStockCustom.h"
#import "UIColor+AWColor.h"

@implementation UIColor (JFStockCustom)

+ (UIColor *)getUpOrDropColor:(double)vaule {
    if (vaule > 0) {
        return [UIColor upRedColor];
    }
    else if(vaule < 0){
        return [UIColor dropGreenColor];
    }
    return [UIColor floorColor];
}

+ (UIColor *)upRedColor {
    if ([self kLineStyle] == 1) {
        return [UIColor awColorWithHexString:@"#60B782"];
    }else
        return [UIColor awColorWithHexString:@"#E5425E"];
}

+ (UIColor *)dropGreenColor {
    if ([self kLineStyle] == 1) {
         return [UIColor awColorWithHexString:@"#E5425E"];
    }else
        return [UIColor awColorWithHexString:@"#60B782"];    
}

+ (UIColor *)floorColor {
    if ([self kLineStyle] == 1) {
        return [UIColor colorWithHexString:@"#999999"];
    }else{
        return [UIColor colorWithHexString:@"#797E8B"];
    }
}

+ (UIColor *)getUpOrDropBgColor:(double)vaule {
    if (vaule > 0) {
        return [UIColor upRedBgColor];
    }
    else if(vaule < 0){
        return [UIColor dropGreenBgColor];
    }
    return [UIColor awColorWithHexString:@"#797E8B"];
}

+ (UIColor *)upRedBgColor {
    return [UIColor awColorWithHexString:@"#4f2538"];
}

+ (UIColor *)dropGreenBgColor {
    return [UIColor awColorWithHexString:@"#244b3d"];
}

+ (NSInteger)kLineStyle {
    return [[NSUserDefaults standardUserDefaults] integerForKey:@"AW_tradeKLineStyle_JF"];
}

+ (UIColor *)getMarketBackgroundColor:(NSString *)market {
    if ([@"US" isEqualToString:market]) {
        return [UIColor colorWithHexString:@"#3595FB"];
    }else if ([@"SH" isEqualToString:market] || [@"SZ" isEqualToString:market]){
        return [UIColor colorWithHexString:@"#25D80A"];
    }else{
        return [UIColor colorWithHexString:@"#FC4D6A"];
    }
}

@end
